import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:huajianshe_app/base/AppNavigator.dart';
import 'package:huajianshe_app/base/BaseState.dart';
import 'package:huajianshe_app/common/AppRouter.dart';
import 'package:huajianshe_app/common/load_image.dart';
import 'package:huajianshe_app/common/res.dart';
import 'package:huajianshe_app/widget/RoundedCornerWidget.dart';
import 'package:huajianshe_app/widget/appbar/CAppBar.dart';

class LabelSettingPage extends StatefulWidget {

  final String memberSn;

  const LabelSettingPage(this.memberSn, {Key? key}) : super(key: key);

  @override
  State<StatefulWidget> createState() {
    return _LabelSettingPageState();
  }
}

class _LabelSettingPageState extends BaseState<LabelSettingPage> {

  final TextEditingController remarkController = TextEditingController();
  final TextEditingController labelController = TextEditingController();

  @override
  Widget build(BuildContext context) {
    return
        Scaffold(
          backgroundColor: C.grayF6,
          appBar: CAppBar(title: '设置备注和标签', overlayStyle: SystemUiOverlayStyle.dark, backImgUrl: 'ic_black_arrow',),
          body: Column(children: [
            H(12),
            RoundedCornerWidget(backgroundColor: Colors.white, width: double.infinity, height: 50, radius: 13,
                padding: EdgeInsets.symmetric(horizontal: 14), margin: EdgeInsets.symmetric(horizontal: 13),
                child: Row(children: [
                  SizedBox(width: 70, child: Text('备注', style: TS(15, C.gray1A))),
                  Expanded(child: TextField(autofocus: false, controller: remarkController, focusNode: null,
                      style: TS(15, C.gray1A), maxLength: 8, decoration: new InputDecoration(
                          border: InputBorder.none, focusedBorder: InputBorder.none, enabledBorder: InputBorder.none,
                          errorBorder: InputBorder.none, disabledBorder: InputBorder.none,
                          counterText: '', hintText: "最多8字", hintStyle: TS(14, C.grayC3))
                  )),
                ])
            ),
            H(10),
            RoundedCornerWidget(backgroundColor: Colors.white, width: double.infinity, height: 50, radius: 13,
                padding: EdgeInsets.symmetric(horizontal: 14), margin: EdgeInsets.symmetric(horizontal: 13),
                child: Row(children: [
                  SizedBox(width: 70, child: Text('标签', style: TS(15, C.gray1A))),
                  Expanded(child: GestureDetector(onTap: () => setLabel(), child: TextField(autofocus: false, controller: labelController, focusNode: null, enabled: false,
                      style: TS(15, C.gray1A), maxLength: 8, decoration: new InputDecoration(
                          border: InputBorder.none, focusedBorder: InputBorder.none, enabledBorder: InputBorder.none,
                          errorBorder: InputBorder.none, disabledBorder: InputBorder.none,
                          counterText: '', hintText: "请添加标签对联系人进行分类", hintStyle: TS(14, C.grayC3))
                  ))),
                  LoadImage('ic_gray_right_arrow')
                ])
            ),
          ]),
        );
  }

  setLabel() {
    print('set label');
    AppNavigator.push(context, RouteName.LABEL_LIST);
  }
}